package com.jiunuan.live.im.provider.rpc;

import com.jiunuan.live.im.interfaces.ImTokenRpc;
import com.jiunuan.live.im.provider.service.ImTokenService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * @Author: JiuNuan
 * @CreateTime: 2024-08-13 13:51
 * @Description: token校验rpc实现
 */
@DubboService
public class ImTokenRpcImpl implements ImTokenRpc {
    @Resource
    private ImTokenService imTokenService;
    /**
     * 创建用户登录im服务的token
     *
     * @param userId
     * @param appId
     * @return
     */
    @Override
    public String createImLoginToken(long userId, int appId) {
        return imTokenService.createImLoginToken(userId, appId);
    }

    /**
     * 根据token检索用户id
     *
     * @param token
     * @return
     */
    @Override
    public Long getUserIdByToken(String token) {
        return imTokenService.getUserIdByToken(token);
    }
}
